﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ReviewCurveApp.Classes;

namespace ReviewCurveApp
{
    public partial class FrmUnitView : Form
    {
        public FrmUnitView()
        {
            InitializeComponent();
        }

        Unit _Unit = new Unit();

        private void buttonCommit_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }

        internal void SetUnit(Unit unit)
        {
            _Unit = unit;
        }

        private void FrmUnitView_Load(object sender, EventArgs e)
        {
            DisplayUnit();
        }

        private void DisplayUnit()
        {
            ClearUI();
            txt_ItemName.Text = _Unit.Name;
            txt_Description.Text = _Unit.Description;
            //dateTimePicker1.Value = _Unit.ScheduledDateTime;
            label_Status.Text = "Status:\t" + _Unit.Status.ToString();
            label_Tasks.Text = "Tasks:\r\n" + _Unit.GetTasksInString();
        }

        private void ClearUI()
        {
            txt_ItemName.Text = "";
            txt_Description.Text ="";
            //dateTimePicker1.Value = _Unit.ScheduledDateTime;
            label_Status.Text = "Status:";
            label_Tasks.Text = "Tasks:\r\n";
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }
    }
}
